def is_prime(n):
    if n <= 1:
        return False
    if n <= 3:
        return True
    if n % 2 == 0 or n % 3 == 0:
        return False
    i = 5
    while i * i <= n:
        if n % i == 0 or n % (i + 2) == 0:
            return False
        i += 6
    return True
def closest_prime(num):
    if num <= 1:
        return 2
    prime = num
    found = False
    if is_prime(num):
        return num
    while not found:
        prime += 1
        if is_prime(prime):
            found = True
    return prime
a = list(map(str, input().split()))
b = ''
for i in a:
    if i == "zero":
        b += "0"
    if i == "one":
        b += "1"
    if i == "two":
        b += "2"
    if i == "three":
        b += "3"
    if i == "four":
        b += "4"
    if i == "five":
        b += "5"
    if i == "six":
        b += "6"
    if i == "seven":
        b += "7"
    if i == "eight":
        b += "8"
    if i == "nine":
        b += "9"
c = int(b)
print(closest_prime(c))